package com.aps.web.controller.business_department;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.aps.common.annotation.Log;
import com.aps.common.core.controller.BaseController;
import com.aps.common.core.domain.AjaxResult;
import com.aps.common.enums.BusinessType;
import com.aps.system.domain.VexpDevelopsampleClothingProcessnewA;
import com.aps.system.service.IVexpDevelopsampleClothingProcessnewAService;
import com.aps.common.utils.poi.ExcelUtil;
import com.aps.common.core.page.TableDataInfo;

/**
 * VIEWController
 *
 * @author aps
 * @date 2024-07-15
 */
@RestController
@RequestMapping("/system/Sample_Weekly_Report")
public class VexpDevelopsampleClothingProcessnewAController extends BaseController {
    @Autowired
    private IVexpDevelopsampleClothingProcessnewAService vexpDevelopsampleClothingProcessnewAService;

    /**
     * 查询VIEW列表
     */
    @PreAuthorize("@ss.hasPermi('system:Sample_Weekly_Report:list')")
    @GetMapping("/list")
    public TableDataInfo list(VexpDevelopsampleClothingProcessnewA vexpDevelopsampleClothingProcessnewA) {
        startPage();
        List<VexpDevelopsampleClothingProcessnewA> list = vexpDevelopsampleClothingProcessnewAService.selectVexpDevelopsampleClothingProcessnewAList(vexpDevelopsampleClothingProcessnewA);
        return getDataTable(list);
    }

    /**
     * 导出VIEW列表
     */
    @PreAuthorize("@ss.hasPermi('system:Sample_Weekly_Report:export')")
    @Log(title = "VIEW" , businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VexpDevelopsampleClothingProcessnewA vexpDevelopsampleClothingProcessnewA) {
        List<VexpDevelopsampleClothingProcessnewA> list = vexpDevelopsampleClothingProcessnewAService.selectVexpDevelopsampleClothingProcessnewAList(vexpDevelopsampleClothingProcessnewA);
        ExcelUtil<VexpDevelopsampleClothingProcessnewA> util = new ExcelUtil<VexpDevelopsampleClothingProcessnewA>(VexpDevelopsampleClothingProcessnewA.class);
        util.exportExcel(response, list, "VIEW数据");
    }

    /**
     * 获取VIEW详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:Sample_Weekly_Report:query')")
    @GetMapping(value = "/{YWP}")
    public AjaxResult getInfo(@PathVariable("YWP") String YWP) {
        return success(vexpDevelopsampleClothingProcessnewAService.selectVexpDevelopsampleClothingProcessnewAByYWP(YWP));
    }

    /**
     * 新增VIEW
     */
    @PreAuthorize("@ss.hasPermi('system:Sample_Weekly_Report:add')")
    @Log(title = "VIEW" , businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VexpDevelopsampleClothingProcessnewA vexpDevelopsampleClothingProcessnewA) {
        return toAjax(vexpDevelopsampleClothingProcessnewAService.insertVexpDevelopsampleClothingProcessnewA(vexpDevelopsampleClothingProcessnewA));
    }

    /**
     * 修改VIEW
     */
    @PreAuthorize("@ss.hasPermi('system:Sample_Weekly_Report:edit')")
    @Log(title = "VIEW" , businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VexpDevelopsampleClothingProcessnewA vexpDevelopsampleClothingProcessnewA) {
        return toAjax(vexpDevelopsampleClothingProcessnewAService.updateVexpDevelopsampleClothingProcessnewA(vexpDevelopsampleClothingProcessnewA));
    }

    /**
     * 删除VIEW
     */
    @PreAuthorize("@ss.hasPermi('system:Sample_Weekly_Report:remove')")
    @Log(title = "VIEW" , businessType = BusinessType.DELETE)
    @DeleteMapping("/{YWPs}")
    public AjaxResult remove(@PathVariable String[] YWPs) {
        return toAjax(vexpDevelopsampleClothingProcessnewAService.deleteVexpDevelopsampleClothingProcessnewAByYWPs(YWPs));
    }


    @GetMapping("/getVexpDevelopsampleClothingProcessnewAList")
    public TableDataInfo getVexpDevelopsampleClothingProcessnewAList(String type) {
        System.out.println(type);
        startPage();
        return getDataTable(vexpDevelopsampleClothingProcessnewAService.getVexpDevelopsampleClothingProcessnewA(type));
    }
}
